/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.baladaboa.ws.core;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Leone
 */
@Entity
@Table(name = "plano", catalog = "dbbaladaboa", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Plano.findAll", query = "SELECT p FROM Plano p"),
    @NamedQuery(name = "Plano.findByIdplano", query = "SELECT p FROM Plano p WHERE p.idplano = :idplano"),
    @NamedQuery(name = "Plano.findByValor", query = "SELECT p FROM Plano p WHERE p.valor = :valor")})
public class Plano implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idplano", nullable = false)
    private Integer idplano;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 2147483647)
    @Column(name = "descricao", nullable = false, length = 2147483647)
    private String descricao;
    @Basic(optional = false)
    @NotNull
    @Column(name = "valor", nullable = false)
    private float valor;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "planoIdplano")
    private List<Casa> casaList;

    public Plano() {
    }

    public Plano(Integer idplano) {
        this.idplano = idplano;
    }

    public Plano(Integer idplano, String descricao, float valor) {
        this.idplano = idplano;
        this.descricao = descricao;
        this.valor = valor;
    }

    public Integer getIdplano() {
        return idplano;
    }

    public void setIdplano(Integer idplano) {
        this.idplano = idplano;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public float getValor() {
        return valor;
    }

    public void setValor(float valor) {
        this.valor = valor;
    }

    @XmlTransient
    public List<Casa> getCasaList() {
        return casaList;
    }

    public void setCasaList(List<Casa> casaList) {
        this.casaList = casaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idplano != null ? idplano.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Plano)) {
            return false;
        }
        Plano other = (Plano) object;
        if ((this.idplano == null && other.idplano != null) || (this.idplano != null && !this.idplano.equals(other.idplano))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.baladaboa.ws.core.Plano[ idplano=" + idplano + " ]";
    }
    
}
